#ifndef __MAILER__
#define __MAILER__
#include "UnBoundedMailBox.h"
#include "BoundedMailBox.h"
#include <map>

class Mailer:public Thread
{

	private:
		UnBoundedMailBox* mailbox;
		//Kernel* system;
		int m_numOfMailBoxes;
		int holding;
		map<int,BoundedMailBox*> m_nodesMailboxes;
		static void* sendRecieve(void* arg);

	public:
		Mailer();
		~Mailer();
		void clearMailBoxes();
		void setNodesMailBoxes(map<int,BoundedMailBox*> nodesMailBoxes,int numOfMailBoxes);
		void insert(int DestinationNodeID, Message* msg);//do we really need this?? :P need to check DestinationNodeID if its part of the Message it is not needed
		int getMaxLength();  
		int getMailBoxSize();
		bool isDeadlocked(int id);
		void emptyMailBox(); 
		BoundedMailBox* getMailbox(int i);
};
		
#endif

